"""搜索记录相关数据模型"""

from datetime import datetime
from typing import Optional

from pydantic import BaseModel, ConfigDict


class SearchRecordQueryModel(BaseModel):
    """搜索记录查询参数"""

    keyword: Optional[str] = None
    item_id: Optional[str] = None
    task_id: Optional[int] = None
    is_new: Optional[str] = None
    is_ordered: Optional[str] = None
    start_time: Optional[datetime] = None
    end_time: Optional[datetime] = None


class SearchRecordModel(BaseModel):
    """搜索记录返回模型"""

    model_config = ConfigDict(from_attributes=True)

    id: Optional[int] = None
    task_id: Optional[int] = None
    keyword: Optional[str] = None
    item_id: Optional[str] = None
    item_title: Optional[str] = None
    item_price: Optional[str] = None
    item_url: Optional[str] = None
    is_new: Optional[str] = None
    is_ordered: Optional[str] = None
    found_time: Optional[datetime] = None
    create_time: Optional[datetime] = None
    item_data: Optional[str] = None
